x86/HVM: sanity check xsave area when migrating or restoring from older Xen versions
authorDon Koch <dkoch@verizon.com>
Mon, 27 Oct 2014 15:45:09 +0000 (16:45 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 27 Oct 2014 15:45:09 +0000 (16:45 +0100)
commitd7bb8e88a087690feba63ef83c13ba067f041da0
treef9551ef2ca9ddabbbd695781afca901f15959c01
parent4ed4dc689761a5597a492aeef89aff50cd9b39ef
x86/HVM: sanity check xsave area when migrating or restoring from older Xen versions

Xen 4.3.0, 4.2.3 and older transferred a maximum sized xsave area (as
if all the available XCR0 bits were set); the new version only
transfers based on the actual XCR0 bits. This may result in a smaller
area if the last sections were missing (e.g., the LWP area from an AMD
machine). If the size doesn't match the XCR0 derived size, the size is
checked against the maximum size and the part of the xsave area
between the actual and maximum used size is checked for zero data. If
either the max size check or any part of the overflow area is
non-zero, we return with an error.

Signed-off-by: Don Koch <dkoch@verizon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/hvm/hvm.c